﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="pgCateg.aspx.cs" Inherits="EGuayas.Web.Licenciamiento.admin.tabs.pgCateg" %>
<%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>
<%@ Register Src="~/Licenciamiento/admin/tabs/wucFechaInsp.ascx" TagPrefix="uc1" TagName="wucFechaInsp" %>

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
    <link href="~/Resources/css/Style.css" rel="stylesheet" />
    <!-- Load Ext JS -->
    <script src="../../../Resources/js/Global.js"></script>
</head>
<body>
    <form id="Form1" runat="server">
        <ext:ResourceManager ID="ResourceManager1" runat="server" />       
        <ext:Viewport ID="Viewport1" runat="server" Layout="BorderLayout">
            <Items>
                <ext:Hidden Text="" ID="hdEventoNow" runat="server" />
            
                <%--::Panel Tab Inicio--%>
                <ext:FormPanel ID="FormPanelGeneral" runat="server" Region="Center" Layout="VBoxLayout">
                    <LayoutConfig>
                        <ext:VBoxLayoutConfig Align="Stretch" />
                    </LayoutConfig>
                    <TopBar>
                        <ext:Toolbar ID="Toolbar1" runat="server">
                            <Items>
                                 <ext:Button ID="btnExp" runat="server" Text="Mostrar Expediente"   Icon="Table">
                                    <Listeners>
                                        <Click Handler="pgFnCat.showExpediente();" />
                                    </Listeners>
                                </ext:Button>
                                 <ext:Button ID="btnFecha" runat="server" Text="Fecha de Inspección"   Icon="ClockEdit">
                                    <Listeners>
                                        <Click Handler="pgFnCat.showFechaInsp();" />
                                    </Listeners>
                                </ext:Button>
                                <ext:ToolbarFill />
                                <ext:Button ID="ShowTab1" runat="server" Text="Mostrar Documentos"  Disabled="true" Icon="PageWhiteStack">
                                    <Listeners>
                                        <Click Handler="#{TabPanel1}.addTab(#{Tab1},1);this.setDisabled(true);" />
                                    </Listeners>
                                </ext:Button>
                                <ext:Button ID="ShowTab2" runat="server" Text="Mostrar Tareas"  Icon="Wrench">
                                    <Listeners>
                                        <Click Handler="#{TabPanel1}.addTab(#{Tab2},2);this.setDisabled(true);" />
                                    </Listeners>
                                </ext:Button>
                                <ext:Button ID="ShowTab3" runat="server" Text="Mostrar Informe" Icon="Report">
                                    <Listeners>
                                        <Click Handler="#{TabPanel1}.addTab(#{Tab3},3);this.setDisabled(true);" />
                                    </Listeners>
                                </ext:Button>
                               
                            </Items>
                        </ext:Toolbar>
                    </TopBar>
                    <Items>
                        <ext:TabPanel ID="TabPanel1" runat="server" Flex="1" TabPosition="Left" ActiveIndex="1">
                            <Items>
                                   <%--
                                  <ext:Panel ID="TabIE" Title="Expediente" runat="server" Icon="Table" Layout="Fit">   
                                                            
                                        <Loader ID="Loader1"  runat="server" Url="../../../Expedientes/pgEditExpediente.aspx" Mode="Frame">
                                             <LoadMask ShowMask="true" />
                                        </Loader>  
                                                                           
                                 </ext:Panel>
                                 --%>
                                  <ext:Panel ID="TabCong" Title="Configuración" runat="server" Icon="WrenchOrange" Layout="Fit">
                                    <Loader ID="Loader2" runat="server"  Mode="Frame">
                                        <LoadMask ShowMask="true" />
                                    </Loader>
                                 </ext:Panel>                      
                              
                                <ext:Panel ID="Tab1" Title="Documentos" runat="server" Closable="true" CloseAction="Hide" Icon="PageWhiteStack" Layout="Fit">
                                    <Items>
                                        <%--::Archivos Licenciamiento--%>
                                        <ext:UserControlLoader ID="uc_corregdoc_l001" UserControlID="wuc_corregdoc_categoria_l001" runat="server" Path="~/Licenciamiento/admin/tabs/wucCorreguirDoc.ascx" OnComponentAdded="OnCorreguirDocCategoriaAdded" />
                                    </Items>
                                    <Listeners>
                                        <Close Handler="#{ShowTab1}.setDisabled(false);" />
                                    </Listeners>
                                </ext:Panel>
                                <ext:Panel ID="Tab2" Title="Tareas" runat="server" Closable="true" CloseAction="Hide" Icon="Wrench" Layout="Fit" >
                                    <Items>
                                        <%--::Tareas--%>
                                        <ext:UserControlLoader ID="uc_tareas_L003" UserControlID="wuc_tarea_categoria_l003" runat="server" Path="~/Licenciamiento/admin/tabs/wucTareas.ascx" OnComponentAdded="OnTareasCategoriaAdded" />

                                    </Items>
                                    <Listeners>
                                        <Close Handler="#{ShowTab2}.setDisabled(false);" />
                                    </Listeners>
                                </ext:Panel>
                                <ext:Panel ID="Tab3" Title="Informe" runat="server" Closable="true" CloseAction="Hide" Icon="Report" Layout="Fit">
                                    <Items>
                                        <%--::Informe--%>
                                        <ext:UserControlLoader ID="uc_correginfodoc_l001" UserControlID="wuc_correginfodoc_cat_l01" runat="server" Path="~/Licenciamiento/admin/tabs/wucInformeCorrecion.ascx" OnComponentAdded="OnInformeCorrecionAdded" />
                                    </Items>
                                    <Listeners>
                                        <Close Handler="#{ShowTab3}.setDisabled(false);" />
                                    </Listeners>
                                </ext:Panel>
                                 
                             
                            </Items>
                            <Bin></Bin>
                            <Listeners>
                                <TabChange Handler="pgFnCat.activateTab(item,newTab);"></TabChange>
                            </Listeners>
                        </ext:TabPanel>
                    </Items>
                </ext:FormPanel>
                

                
            </Items>
        </ext:Viewport>
        <uc1:wucFechaInsp runat="server" id="wucFechaInsp" />
    </form>
    <ext:XScript ID="XScript1" runat="server">
    <script  type="text/javascript">
        var pgFnCat = new Object();
        pgFnCat.winExp = null;
        //
        pgFnCat.showFechaInsp = function () {
            App.direct.ShowFecha({
                success: function (result) {
                        #{winFechInsp}.show();                          
                },
                eventMask: {
                    showMask: true,
                    minDelay: 500
                }
            });
          
        };
        //Cerrar
        pgFnCat.activateTab = function (item, newTab) {
            //Actualiza en caso de tab recien configure
            /*
            if (newTab.title == "Configuración") {
              #{TabCong}.reload();
            }
            */
        };
        pgFnCat.showExpediente = function () {
            if (pgFnCat.winExp == null) {
                pgFnCat.winExp = new Ext.Window({
                    id: "winExp", title: "Expediente", iconCls: "#Table",
                    closeAction: "Hide", renderTo: Ext.getBody(),
                    resizable: true, maximizable: false, minimizable: false,
                    collapsible: false, draggable: true, isMinimized: false,
                    isMaximized: false, minWidth: 750, minHeight: 450,
                    width: 700, height: 450, isModal: false, constrain: true,
                    loader: {
                        url: "../../../Expedientes/pgEditExpediente.aspx",
                        renderer: "frame",
                        disableCaching: true,
                        loadMask: {
                            showMask: true
                        },
                        listeners: {
                            load: function (control) {
                                control.target.iframe.dom.contentWindow.parentWindow = control.target;
                            }
                        }
                    },
                    listeners:
                        {
                            close: {
                                fn: function (el) {

                                }
                            }
                        }
                });
            }
            pgFnCat.winExp.show();
        };
 </script>
    </ext:XScript>
</body>
</html>
